home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
pascal
/
tpstat.exe
/
STAT.DOC
< prev
next >
Wrap
Text File
|
1990-08-08
|
43KB
|
1,382 lines
Libraries of Elementary
Statistical and Mathematical
Subprograms
for
Turbo Pascal Version 5.X
Version 1.0
by
Norton Associates
506 Post Oak Dr.
Baytown Tx. 77520
Compuserve 70441,1337
SUMMARY OF FEATURES
Version 1.0 of this software contains 30 elementary statistical and 19
mathematical subprograms. The MATH Unit was designed to add the
FORTRAN-77 intrinsic math functions, except for complex math, that are
not provided by Turbo Pascal Version 5.X. However, some additional
math functions have been added to the MATH Unit as appropriate.
STAT Unit
- Uniform and normal random number generators
- 4 different types mean
- Summary Statistics ( first four moments, etc )
- Percentiles and quartiles
- Standard errors of parameters for normal distributions
- Cumulative frequency normal distribution statistics
- Integral frequency normal distribution statistics
- Correlation ( product moment and auto lag)
- Regression ( polynomial and multiple variable )
- Smoothing ( binomial, moving average and curvilinear )
- Sorting ( insert and quick )
- Other tools ( determinant and remove average )
MATH Unit
- Radian to degree conversion
- Normal trigonometric functions ( tan, secant etc )
- Inverse trigonometric functions ( atan2, arcsin etc )
- Hyperbolic functions ( sinh, cosh, tanh )
- Logarithmic functions ( power, log to any base etc )
- Other functions (factorial and root of an equation )
POSSIBLE FUTURE ENHANCEMENTS
- Cross lag correlation ( two variable)
- Increase variety of standard errors
- Contour plotting program
- Spline smoothing functions
- Integration
- Error functions
- Interpolation and extrapolation
- Gamma and Bessel functions
- Graphics ( plot function )
- Better use of 8087 coprocessor ( i.e., use 8087 tan
function
- Arrays larger than 16380 single precision elements. Have
created a single dimension array containing 130000
elements not 16380 as currently implemented.
- Complex Math functions
1.0 Introduction
1.1 Background
The statistical programs contained in the STAT Unit were originally
developed in FORTRAN over the years. With the advent of a good Pascal
environment, the use and need of FORTRAN to statistically crunch data
have diminished drastically.
The MATH Unit was developed because the language of Pascal does not
contain all the intrinsic math functions as those contained in the
standard FORTRAN-77 intrinsic function library [6]. The combination
of Turbo Pascal's math functions and those contained in this MATH Unit
provides the same functionality as those contained in the FORTRAN-77
intrinsic function library, except for complex math.
The user of these libraries are assumed to be familiar with
statistics. The definitions of terms used in these libraries can be
found by reviewing the reference contained in Section 5.0. Additional
statistical and mathematical tools will be added in the future.
This is a shareware product. Register your copy of the STAT and MATH
libraries by reading the README.DOC file contained with this
disk(ette) and sending in the nominal $35 to register the software.
1.2 Converting the Statistical Unit to Turbo Pascal
Several things happened while converting the statistical software from
FORTRAN to Pascal.
First, the size of the arrays - With the the advent of Personal
Computers (PC's), many mainframe FORTRAN programs have been converted
to PC's. In most cases special care had to be taken when the size of
the arrays multiplied by the size of the element exceeded 64k (65520
bytes). This limitation was due to the 8086 segmented architecture.
Most FORTRAN vendors implemented a way around the 8086 segmented
architecture. Well, Turbo Pascal has no provided such a capability
[1]. The segmented architecture of the 8086 family basically limits
the size of an array. The below table explains the size of the
element and the number of elements in the 65k 8086 architecture
boundary.
Table 1.
Element Size Maximum number of
type (bytes) elements in array STAT types
------- -------- ------------------ ----------------------
Single 4 16380 single_array_pointer
Longint 4 16380 longint_array_pointer
For example, this table states that the maximum number of elements
(indices of the array) of a single precision array is 16380 elements
in a 65K segment. This is satisfactory for most applications.
However, for some applications a vast increase in the number of
elements in the array was needed. To make a long story short, I have
developed a single precision array which which contains 130000
elements in the array. This implies that the memory requirements for
this array size alone is 520000 bytes. I have not completed testing
of this version of the software.
Second, the 640k DOS limitation - There are two major issues. How can
a user make best use of the 640k DOS limitation and if the user needed
more memory could he/she use extended/expanded memory for array
storage? The latter issue is not addressed in this version of the
software. The former issue was challenging enough.
With a fixed size of DOS, the number of arrays and the number of
elements in the arrays is very finite. Not knowing the number of
elements required by each user dictated that the STAT unit use the
maximum number of elements from Table 1. If the arrays were
statically created this meant that only 9 arrays of 65k bytes could
ever be created. This was totally not satisfactory. The solution was
to dynamically create the arrays on the heap. The user could then
have the best of both worlds. Basically, heap is the part of memory
between the top of the application in memory and the 640k DOS
limitation. By dynamically creating the arrays, the number of arrays
in the application is now very large and the size of each array may be
up to the full 65k limit. More information on this subject is
contained in the next section.
Finally, the precision - To make the STAT unit more precise, all
normally double precision numbers are in extended precision. By
adding two more bytes per variable, the number of significant digits
increased by four (15 to 19 digits).
1.3 User's Guide to the STAT and MATH Units
1.3.1 Format for the Libraries in Sections 3.0 and 4.0
A standard format for presenting the subprograms contained in the
libraries have been developed for Sections 3.0 and 4.0. An outline of
the standard format is presented directly below.
Name of subprogram here
Purpose: A short purpose statement goes here
Interface: The Turbo Pascal Unit Interface
Errors: Any errors are reported here
Remarks: Any special considerations go here
Example: Sample code go here
1.3.2 STAT Unit
To prevent any unforeseen problems, a series of STAT Unit procedures
have been developed to dynamically create and delete arrays. These
procedures are listed below.
Table 2.
Procedures for
Element Dynamic Creation and Deletion Procedures
Type Create Delete
--------- ------------------- -------------------
Single create_single_array delete_single_array
Longint